package com.ysd.lis.controller.bac;


import com.ysd.common.Result;
import com.ysd.lis.annotation.LogDetail;
import com.ysd.lis.aspect.OperationType;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.entity.bac.BacAntibioticsDict;
import com.ysd.lis.request.DeleteParam;
import com.ysd.lis.request.bac.AntibioticsDictList;
import com.ysd.lis.request.bac.AntibioticsDictParam;
import com.ysd.lis.request.bac.BacAntibioticsDictPageParam;
import com.ysd.lis.service.bac.BacAntibioticsDictService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 抗生素 前端控制器
 * </p>
 *
 * @author Bai
 * @since 2024-01-11
 */
@RestController
@RequestMapping("/lis/bacAntibioticsDict")
public class BacAntibioticsDictController extends BaseController {

    @Autowired
    private BacAntibioticsDictService bacAntibioticsDictService;

    @ApiOperation("获取抗生素信息（分页）")
    @GetMapping("/findAntibioticsDictPageList")
    public Result findAntibioticsDictPageList(BacAntibioticsDictPageParam bacAntibioticsDictPage) {
        return bacAntibioticsDictService.findAntibioticsDictPageList(bacAntibioticsDictPage);
    }

    @ApiOperation("获取抗生素信息")
    @GetMapping("/findAntDictList")
    public Result findAntDictList(BacAntibioticsDictPageParam bacAntibioticsDictPage) {
        return bacAntibioticsDictService.findAntDictList(bacAntibioticsDictPage);
    }

    @ApiOperation("获取所有抗生素信息")
    @GetMapping("/findAntibioticsDictList")
    public Result findAntibioticsDictList() {
        return bacAntibioticsDictService.findAddAntibioticsDictList();
    }

    @ApiOperation("通过仪器id获取所有抗生素信息")
    @GetMapping("/findAntibioticsDictByInstrId")
    public Result findAntibioticsDictByInstrId(AntibioticsDictParam dictParam) {
        return bacAntibioticsDictService.findAntibioticsDictByInstrId(dictParam);
    }

    @ApiOperation("通过仪器id获取绑定抗生素信息")
    @GetMapping("/findInstrAntibDictsByInstrId")
    public Result findInstrAntibDictsByInstrId(AntibioticsDictParam dictParam) {
        return bacAntibioticsDictService.findInstrAntibDictsByInstrId(dictParam);
    }

    @ApiOperation("添加抗生素")
    @PostMapping("/addAntibioticsDict")
    @LogDetail(requestParam = "addAntibioticsDict", operationType = OperationType.INSERT, module = "微生物细菌模块-抗生素", content = "增加【antName】抗生素", businessName = "antName")
    public Result addAntibioticsDict(@RequestBody BacAntibioticsDict bacAntibioticsDict) {
        return bacAntibioticsDictService.addAntibioticsDict(bacAntibioticsDict);
    }


    @ApiOperation("批量修改")
    @PostMapping("/updateBachAntibioticsDict")
    public Result updateBachAntibioticsDict(@RequestBody AntibioticsDictList antibioticsDictList) {
        return bacAntibioticsDictService.updateBachAntibioticsDict(antibioticsDictList);
    }

    @ApiOperation("编辑抗生素")
    @PostMapping("/edit")
    @LogDetail(requestParam = "edit", operationType = OperationType.UPDATE, module = "微生物细菌模块-抗生素", content = "编辑【antName】抗生素", businessName = "antName")
    public Result edit(@RequestBody BacAntibioticsDict bacAntibioticsDict) {
        return bacAntibioticsDictService.editAntibioticsDict(bacAntibioticsDict);
    }

    @ApiOperation("根据id删除抗生素")
    @PostMapping("/deleteAntibioticsDict")
    @LogDetail(requestParam = "deleteAntibioticsDict", operationType = OperationType.DELETE, module = "微生物细菌抗生素模块", content = "删除【names】抗生素", businessName = "names")
    public Result deleteAntibioticsDict(@RequestBody DeleteParam deleteParam) {
        return bacAntibioticsDictService.deleteAntibioticsDict(deleteParam);
    }

    @ApiOperation("通过仪器id获取所有抗生素信息")
    @GetMapping("/findPageAntibioticsDictByInstrId")
    public Result findPageAntibioticsDictByInstrId(AntibioticsDictParam dictParam) {
        return bacAntibioticsDictService.findPageAntibioticsDictByInstrId(dictParam);
    }
}
